package com.sam.demo.spring.boot.jpa.domain.service;

import com.sam.demo.spring.boot.jpa.primary.PrimaryUser;
import com.sam.demo.spring.boot.jpa.primary.PrimaryUserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PrimaryUserService {
    @Autowired
    private PrimaryUserRepository primaryUserRepository;

    public void saveUser(String name) {
        PrimaryUser primaryUser = new PrimaryUser();
        primaryUser.setName(name);
        primaryUserRepository.save(primaryUser);
    }

    public PrimaryUser findUserById(Long id){
        return primaryUserRepository.findOne(id);
    }
}
